import Vue from 'vue'
import VueRouter from 'vue-router'
import MyLogin from '../views/MyLogin.vue'
import HomePage from '../views/HomePage.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/myLogin',
    name: 'MyLogin',
    component: MyLogin,
  },
  {
    path: '/myRegister',
    name: 'MyRegister',
    component: () => import('../views/MyRegister.vue'),
  },
  {
    path: '/homePage',
    // path: '/',
    name: 'HomePage',
    // component: () => import('../views/HomePage.vue'),
    component: HomePage,
    children:[
      {
        path: '/homePageIndex',
        name: 'HomePageIndex',
        component: () => import('../views/HomePageIndex.vue'),
      },
      {
        path: '/findMessageAll',
        name: 'FindMessageAll',
        component: () => import('../views/user-manage/FindMessageAll.vue'),
      },
      {
        path: '/findMessageOnly',
        name: 'FindMessageOnly',
        component: () => import('../views/user-manage/FindMessageOnly.vue'),
      },
      {
        path: '/departmentManage',
        name: 'DepartmentManage',
        component: () => import('../views/department-manage/DepartmentManage.vue')
      },
      {
        path: '/positionManage',
        name: 'PositionManage',
        component: () => import('../views/department-manage/PositionManage.vue')
      },
      {
        path: '/userManage',
        name: 'UserManage',
        component: () => import('../views/department-manage/UserManage.vue')
      },
      {
        path:'/reimburseMent',
        name:'ReimburseMent',
        component: () => import('../views/Financial-manage/ReimburseMent.vue')
      },
      {
        path:'/flowOfMoney',
        name:'FlowOfMoney',
        component: () => import('../views/Financial-manage/FlowOfMoney.vue')
      },
      {
        path:'/fundInquiry',
        name:'FundInquiry',
        component: () => import('../views/Financial-manage/FundInquiry.vue')
      },
      {
        path:'/personIncome',
        name:'PersonIncome',
        component: () => import('../views/Financial-manage/PersonIncome.vue')
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  routes,
})

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router
